<%@ page import="javax.naming.Context" %>
<%@ page import="javax.naming.InitialContext" %>
<%@ page import="edu.columbia.ubms.ejb.UserInfoSessionBeanRemote" %>
<%@ page import="edu.columbia.ubms.ejb.Item" %>

<%@ include file="sessionCheck.jsp"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Setting Page</title>
<link rel="stylesheet" type="text/css" href="ubms.css" media="screen" />
</head>
<body>

<%
	
	int userId = (Integer)session.getAttribute("userid");
	
	//int userId = 1;
	try {   
	    Context ctx = new InitialContext();		
	    UserInfoSessionBeanRemote beanRemote = (UserInfoSessionBeanRemote)ctx.lookup("UserInfoSessionBean/remote");
		Item item = beanRemote.userInformation(userId);
		
%>
<form action="userUpdate.jsp" method="post">
	<div class="div_1">User Name: </div>
	<div>
	<label for="username"><%=item.getUserName()%></label>
	</div>
	
	<div class="div_1">First Name</div><div><input class="input_1" type="text" name="firstname" value="<%=item.getFirstName()%>"/></div>
	<div class="div_1">Last Name</div><div><input class="input_1" type="text" name="lastname" value="<%=item.getLastName()%>"/></div>
	<div class="div_1">e-mail</div><div><input class="input_1" type="text" name="email" value="<%=item.getEmail()%>"/></div>
	
	<div id="msg" style="color:red"></div><div style="clear: both;"></div>
	<div class="div_1">Password</div><div><input class="input_1" type="password" name="password" value="<%=item.getPassword()%>"/></div>
	
	<input type="submit" value="Change">
<%


	} catch(Exception e) {
	    out.println("Error:" + e.getMessage());
	}	
	
	//response.sendRedirect("blogBoxMain.jsp");
%>	

</form>
</body>
</html>